#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
map<int, int> cnt;
struct Movie {
  int b, c, id;
  bool operator<(const Movie& movie) const {
    if (b != movie.b)
      return b > movie.b;
    else
      return c > movie.c;
  }
} movies[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  cin >> m;
  rep(i, 1, m) movies[i].id = i;
  rep(i, 1, m) {
    int x;
    cin >> x;
    movies[i].b = cnt[x];
  }
  rep(i, 1, m) {
    int x;
    cin >> x;
    movies[i].c = cnt[x];
  }
  sort(movies + 1, movies + m + 1);
  cout << movies[1].id;
  return 0;
}